/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package data;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author stana
 */
@Entity
@Table(name = "USERTABLE")
@NamedQueries(
{
    @NamedQuery(name = "Usertable.findAll", query = "SELECT u FROM Usertable u"),
    @NamedQuery(name = "Usertable.findByPassword", query = "SELECT u FROM Usertable u WHERE u.passwd = :password"),
    @NamedQuery(name = "Usertable.findByUserid", query = "SELECT u FROM Usertable u WHERE u.userid = :userid"),
    @NamedQuery(name = "Usertable.findByUseridAndPassword", query = "SELECT u FROM Usertable u WHERE u.userid = :userid AND u.passwd= :password")

})
public class Usertable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @Column(name = "PASSWD")
    private String passwd;
    @Id
    @Basic(optional = false)
    @Column(name = "USERID")
    private String userid;

    public Usertable()
    {
    }

    public Usertable(String userid)
    {
        this.userid = userid;
    }

    public Usertable(String userid, String password)
    {
        this.userid = userid;
        this.passwd = password;
    }

    public String getPassword()
    {
        return passwd;
    }

    public void setPassword(String password)
    {
        this.passwd = password;
    }

    public String getUserid()
    {
        return userid;
    }

    public void setUserid(String userid)
    {
        this.userid = userid;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (userid != null ? userid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Usertable))
        {
            return false;
        }
        Usertable other = (Usertable) object;
        if ((this.userid == null && other.userid != null) || (this.userid != null && !this.userid.equals(other.userid)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "data.Usertable[userid=" + userid + "]";
    }

}
